package edu.whu.rose.clock.kps.algorithm.blinks.binding;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

import edu.whu.rose.clock.kps.algorithm.blinks.index.NKEntry;

public class NKMapBinding extends TupleBinding {

	public Object entryToObject(TupleInput input) {
		double distance = input.readDouble();
		int knode = input.readInt();
		int first = input.readInt();
		NKEntry nke = new NKEntry(distance, knode, first);
		return nke;
	}
	
	public void objectToEntry(Object object, TupleOutput output) {
		NKEntry nke = (NKEntry)object;
		output.writeDouble(nke.getDistance());
		output.writeInt(nke.getKnode());
		output.writeInt(nke.getFirst());
	}

}
